/**
 * 商务合同管理api
 * author：lzw_1006@163.com
 */
import axios from '@/libs/api.request'
export default class commerceContractApi {
  // 获取基础数据类型
  static getSelectValueList (params) {
    return axios.request({
      url: '/SysBasedata/GetSelectValueList',
      method: 'get',
      params: params
    })
  }

  // 获取商务合同模板列表
  static GetTemplateList (params) {
    return axios.request({
      url: '/CommerceContract/GetTemplateList',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }
  // 添加商务合同模板
  static PostContractTemplate (params) {
    return axios.request({
      url: '/CommerceContract/PostContractTemplate',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }
  // 启用禁用合同模板
  static EnableTemplate (params) {
    return axios.request({
      url: '/CommerceContract/EnableTemplate',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }

  // 获取合同管理列表
  static GetContractList (params) {
    return axios.request({
      url: '/CommerceContract/GetContractList',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }
  // 根据销售产品类型获取模板
  static GetTemplates (params) {
    return axios.request({
      url: '/CommerceContract/GetTemplates',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }
  // 获取当前模板字段
  static GetTemplateFields (params) {
    return axios.request({
      url: '/CommerceContract/GetTemplateFields',
      method: 'post',
      params: params,
      enctype: 'multipart/form-data'
    })
  }
  // 提交标准合同
  static PostStandardContract (params) {
    return axios.request({
      url: '/CommerceContract/PostStandardContract',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }
  // 提交非标准合同
  static PostNonstandardContract (params) {
    return axios.request({
      url: '/CommerceContract/PostNonstandardContract',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }

  // 获取待审核合同列表
  static GetNoExamineContractList (params) {
    return axios.request({
      url: '/CommerceContract/GetNoExamineContractList',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }

  // 获取已审核合同列表
  static GetExamineContractList (params) {
    return axios.request({
      url: '/CommerceContract/GetExamineContractList',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }

  // 获取合同附件列表
  static GetContractFileList (params) {
    return axios.request({
      url: '/CommerceContract/GetContractFileList',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }

  // 合同附件下载
  static DownloadContract (params) {
    return axios.request({
      url: '/CommerceContract/DownloadContract',
      method: 'get',
      params: params,
      responseType: 'blob'
    })
  }

  // 盖章合同附件下载
  static DownloadSelaContract (params) {
    return axios.request({
      url: '/CommerceContract/DownloadSelaContract',
      method: 'get',
      params: params,
      responseType: 'blob'
    })
  }

  // 盖章合同附件上传
  static PostSelaContract (id, params) {
    return axios.request({
      url: '/CommerceContract/PostSelaContract?contractid=' + id,
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }

  // 批量下载合同
  static DownloadFiles (params) {
    return axios.request({
      url: '/CommerceContract/DownloadFiles',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }

  // 获取进度
  static ScheduleView (params) {
    return axios.request({
      url: '/CommerceContract/ScheduleView',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }

  // 批量审批或退回===1 审批，0 退回
  static PostContractWorkFlow (params) {
    return axios.request({
      url: '/CommerceContract/PostContractWorkFlow',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }

  // 发起流程
  static RestartContractWorkFlow (params) {
    return axios.request({
      url: '/CommerceContract/RestartContractWorkFlow',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }

  // 回收流程
  static BackWorkFlow (params) {
    return axios.request({
      url: '/CommerceContract/BackWorkFlow',
      method: 'post',
      data: params,
      enctype: 'multipart/form-data'
    })
  }
}
